import { http } from "@/utils/http";

interface FormItemProps {
  id?: number;
  chapterId?: number;
  userId?: number;
}

interface Result {
  code?: number;
  message?: string;
  data?: FormItemProps;
}

interface ResultTable {
  code?: number;
  message?: string;
  data?: Array<{ commentId: number }>;
}

const modulePath = "/learn/chapterLikes";

/** 点赞 */
export const chapterLike = (data?: {
  chapterId: Number;
  id: string;
  userId: number;
}) => {
  return http.request<Result>("post", modulePath + "/like", { data });
};

/** 点赞 */
export const userLikeList = (params?: { userId: number }) => {
  return http.request<ResultTable>("get", modulePath + "/userLikeList", {
    params
  });
};
